package com.lxw.study.behavioral.memento;

import java.util.HashMap;
import java.util.Map;
import java.util.Stack;

/**
 * 看管人
 */
public class Caretaker {
    private final Map<String,Memento> history = new HashMap<>();

    // 保存备忘录
    public void saveMemento(String name,Memento memento) {
        history.put(name,memento);
    }

    // 获取备忘录
    public Memento getMemento(String name) {
        return history.get(name);
    }
    public Memento removeMemento(String name) {
        return history.remove(name);
    }
}
